/*
* author：tim
* date；9.14
*/
class Time
{
    private:
        int hours;
        int minutes;
        int seconds;

    public:
        Time();
        Time(int hour, int min, int sec);//根据指定时间初始化
        void renew(int secs);
        Time operator + (Time adder);//重载加法
        Time operator - (Time minuser);//重载减法
        void display_in_terminal();//在终端显示
        int pass_info();
        ~Time();
};

Time::Time(): hours(0), minutes(0), seconds(0) {}
Time::Time(int hour, int min, int sec): hours(hour), minutes(min), seconds(sec) {}
void Time::renew(int secs)
{
    Time delta(0, 0, secs);
    *this = *this + delta;
}
Time Time::operator + (Time adder)
{
    int total_Time = this->seconds
            + 60 * this->minutes
            + 60 * 60 * this->hours
            + adder.seconds
            + 60 * adder.minutes
            + 60 * 60 * adder.hours;

    Time new_Time = Time();
    new_Time.seconds = total_Time % 60;
    new_Time.minutes = (total_Time / 60) % 60;
    new_Time.hours = (total_Time / 3600) % 24;

    return new_Time;
}
Time Time::operator - (Time minuser)
{
    minuser.seconds = -minuser.seconds;
    minuser.minutes = -minuser.minutes;
    minuser.hours = -minuser.hours;
    return *this + minuser;
}
void Time::display_in_terminal()
{
    std::cout<<">> Now, Time is "<<hours<<":"
        <<minutes<<":"<<seconds<<" ."<<std::endl;
}
int Time::pass_info()
{
    return seconds + minutes * 60 + hours * 3600;
}
Time::~Time() {}



































